package com.ssm.demo.util.global;


/**
 * @description: 全局统一的异常
 */
public class GlobalException extends RuntimeException {

    private final Integer code;
    private final String message;

    /**
     * 用于携带额外的处理数据
     */
    private Object extInfo;

    public GlobalException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public GlobalException(GlobalExceptionEnum exceptionEnum) {
        this(exceptionEnum.getCode(), exceptionEnum.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public Object getExtInfo() {
        return extInfo;
    }

    public void setExtInfo(Object extInfo) {
        this.extInfo = extInfo;
    }
}

